widgetfactory: Create the dialog every time
authorMatthias Clasen <mclasen@redhat.com>
Sat, 8 Aug 2020 13:36:05 +0000 (09:36 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 8 Aug 2020 15:48:32 +0000 (11:48 -0400)
Trying to work around gtk_show_about_dialog() is
not worth it, just recreate the dialog from scratch.

Fixes: #3047
demos/widget-factory/widget-factory.c

index 4265cf5322c6639fb66f15df1fdd9e6f52caebca..612ba462ebb047aa139d0a44b03330243636c280 100644 (file)
@@ -263,6 +263,7 @@ activate_about (GSimpleAction *action,
   char *os_name;
   char *os_version;
   GString *s;
+  GtkWidget *dialog;
 
   s = g_string_new ("");
 
@@ -289,7 +290,8 @@ activate_about (GSimpleAction *action,
                              gtk_get_minor_version (),
                              gtk_get_micro_version ());
 
-  gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
+  dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
+                         "transient-for", gtk_application_get_active_window (app),
                          "program-name", "GTK Widget Factory",
                          "version", version,
                          "copyright", "© 1997—2020 The GTK Team",
@@ -302,9 +304,11 @@ activate_about (GSimpleAction *action,
                          "system-information", s->str,
                          NULL);
 
-  gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (g_object_get_data (G_OBJECT (gtk_application_get_active_window (app)), "gtk-about-dialog")),
+  gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
                                        _("Maintained by"), maintainers);
 
+  gtk_window_present (GTK_WINDOW (dialog));
+
   g_string_free (s, TRUE);
   g_free (version);
   g_free (os_name);